package com.wctj.api.business.common.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wctj.api.base.entity.DdwxAdminSetappWx;
import com.wctj.api.base.utils.InstanceConvertUtil;
import com.wctj.api.business.common.dto.DdwxAdminSetappWxDTO;
import com.wctj.api.business.common.service.DdwxAdminSetappWxService;
import com.wctj.api.business.common.dao.DdwxAdminSetappWxMapper;
import org.springframework.stereotype.Service;

@Service
public class DdwxAdminSetappWxServiceImpl extends ServiceImpl<DdwxAdminSetappWxMapper, DdwxAdminSetappWx> implements DdwxAdminSetappWxService {


    @Override
    public DdwxAdminSetappWxDTO findOneByPayType(int payType) {
        DdwxAdminSetappWx setappApp = new LambdaQueryChainWrapper<>(baseMapper)
                .or(iq -> iq.eq(DdwxAdminSetappWx::getWxpay, payType))
                .one();
        return InstanceConvertUtil.convertObject(setappApp, DdwxAdminSetappWxDTO.class);
    }
}
